import {getColorStr} from '../themes';
import {Switch as RNSwitch} from 'react-native';

export const Switch = (props: any) => {
  const {
    trackColorKey = 'color_10',
    trackColorActKey = 'color_1',
    thumbColorKey = 'color_2',
    thumbActColorKey = 'color_2',
    ios_backgroundColorKey = 'color_10',
    theme,
    value,
    ...rest
  } = props;

  return (
    <RNSwitch
      trackColor={{
        false: getColorStr(theme, trackColorKey),
        true: getColorStr(theme, trackColorActKey),
      }}
      thumbColor={
        value
          ? getColorStr(theme, thumbActColorKey)
          : getColorStr(theme, thumbColorKey)
      }
      ios_backgroundColor={getColorStr(theme, ios_backgroundColorKey)}
      value={value}
      {...rest}
    />
  );
};
